package br.com.wepa.webapps.orca.logica.negocio.facade;

import br.com.wepa.webapps.logger.TraceLogger;
import br.com.wepa.webapps.orca.logica.modelo.Construtora;
import br.com.wepa.webapps.orca.logica.modelo.Uf;
import br.com.wepa.webapps.orca.logica.negocio.BusinessException;
import br.com.wepa.webapps.orca.logica.negocio.BusinessManager;
import br.com.wepa.webapps.orca.logica.negocio.facade.to.ConstrutoraTO;
import br.com.wepa.webapps.orca.logica.persistencia.ConstrutoraDAO;

class ConstrutoraFacade extends BusinessManager<ConstrutoraTO,Construtora, Integer, ConstrutoraDAO> implements CosntrutoraFacadeHome {
	private static TraceLogger logger  = new TraceLogger(ConstrutoraFacade.class);
	
	@Override
	public ConstrutoraTO find(ConstrutoraTO to) throws BusinessException {
		to.addOrder("nome", true);
		return super.find(to);
	}
	
	@Override
	public ConstrutoraTO findAll(ConstrutoraTO to) throws BusinessException {
		to.addOrder("nome", true);
		return super.findAll(to);
	}
	@SuppressWarnings("unchecked")
	@Override
	public ConstrutoraTO setUp(ConstrutoraTO to) throws BusinessException {
		logger.entering();
		to.enableSearcher();	
		to.getSearcher().addSearchBean("ufList", new Uf());
		to = super.setUp(to);
		
		logger.exiting();
		return to;
	}

}
